﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Moq;

namespace MoqContrib.AutoMock.Tests.MockGenerators
{
    [TestFixture]
    public class WhenGeneratingMocks
    {
        #region Types used for testing
        public interface IService { }
        #endregion

        [Test]
        public void I_will_throw_when_given_a_null_type()
        {
            var mf = new MockGenerator();
            Assert.Throws<ArgumentException>(() => mf.Generate(null));
        }

        [Test]
        public void I_will_return_a_mock_of_the_right_type()
        {
            var mf = new MockGenerator();
            var m = mf.Generate(typeof(IService));
            Assert.That(m, Is.Not.Null);
            var real = (Mock<IService>)m;
            Assert.That(real.Object, Is.Not.Null);
        }
    }
}
